//
// Created by wze-zero on 2024/10/24.
//
#include <iostream>

using namespace std;

int Hermite(int n, int num) {
    if (n == 0) {
        return 1;
    } else if (n == 1) {
        return 2 * n;
    } else {
        return 2 * num * Hermite(n - 1, num) - 2 * (n - 1) * Hermite(n - 2, num);
    }
}

int main() {
    int n, num;
    cin >> n >> num;
    cout << Hermite(n, num) << endl;
    return 0;
}